C# 檔案相關應用


檢查檔案位置是否存在

bool isFileExists = File.Exists(@"C:\檔案路徑");//存在為true

瀏覽檔案(檔案名稱)

private void button1_Click(object sender, EventArgs e)
{
    OpenFileDialog openFileDialog = new OpenFileDialog();
    if (openFileDialog.ShowDialog() == DialogResult.OK)
    {
        string templateName = openFileDialog.FileName;
        textBox1.Text = templateName;
    }
}
#C# #Winform







你可能感興趣的文章

AppWorks School Batch #16 Front-End Class 學習筆記&心得(駐點階段四:個人專案~Sprint 1)

AppWorks School Batch #16 Front-End Class 學習筆記&心得(駐點階段四:個人專案~Sprint 1)

留言板、API篇

留言板、API篇

[MSSQL] 取得特定年、月、星期的所有日期

[MSSQL] 取得特定年、月、星期的所有日期






留言討論